<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件</title>
</head>
<body>
    <img id="img" src="img/01.png"/>
    <br>
    <button id="up">上一张</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button id="down">下一张</button>
</body>
<script>
    let down = document.getElementById("down")
    down.onclick = function(){
       let img = document.getElementById("img")
       img.setAttribute("src","img/02.png")
    }
    let up = document.getElementById("up")
    up.onclick = function(){
       let img = document.getElementById("img")
       img.setAttribute("src","img/01.png")
    }
</script>
</html>